package com.wswy.wyjk.ui.main.choose.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wswy.wyjk.R;
import com.wswy.wyjk.model.LicenseType;

public class CarTypeAdapter extends BaseQuickAdapter<LicenseType, BaseViewHolder> {
    private String title = "小车";

    public CarTypeAdapter() {
        super(R.layout.layout_item_choose_type);
    }

    @Override
    protected void convert(BaseViewHolder helper, LicenseType licenseType) {
        helper.setText(R.id.tv_type_title, licenseType.getTitle());
        ImageView imageView = helper.getView(R.id.img_type);
        imageView.setImageResource(licenseType.getIcon());
        if (licenseType.getTitle().equals(title)) {
            helper.getView(R.id.ll_all).setSelected(true);
        } else {
            helper.getView(R.id.ll_all).setSelected(false);
        }
    }

    public void setTitle(String title) {
        this.title = title;
        notifyDataSetChanged();
    }
}
